package com.example.studentportrait.controller.frontend;


import com.example.studentportrait.domain.ResponseResult;
import com.example.studentportrait.domain.dto.UserDto;
import com.example.studentportrait.domain.entity.*;
import com.example.studentportrait.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;
    //用户注册
    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user){
        return userService.register(user);
    }
    //用户登录
    @PostMapping("/login")
    public ResponseResult login(@RequestBody UserDto userDto){
        return userService.login(userDto);
    }
}

